<template>
  <div>
    <p>当前认证类型：{{ type }}</p>
    <el-button type="primary" plain @click="go">开发者认证</el-button>
  </div>
</template>

<script setup lang="ts">
defineOptions({ name: 'Certification' })
import { getCertificationDetail } from '@/api/system/user/profile'
import { getssoToken } from '@/utils/auth'
import { appKey } from '@/sso'
const type = ref('')
const getDetail = async () => {
  const params = {
    appkey: appKey,
    token: getssoToken(),
    sens: 'not'
  }
  const res = await getCertificationDetail(params)
  if (res.certType == 2) {
    type.value = '企业/机构开发者'
  } else if (res.certType == 1) {
    type.value = '个人开发者'
  } else {
    type.value = '未认证'
  }
}
const go = () => {
  window.open(
    `https://cert.geovisearth.com/certification?appkey=${appKey}&token=${getssoToken()}`,
    '_blank'
  )
}
onMounted(async () => {
  await getDetail()
})
</script>

<style scoped></style>
